package com.longge;

public class MinimumSteps {
//区分黑球与白球
    public long minimumSteps(String s) {



        char[] chars = s.toCharArray();
        int left = 0;
        int right = chars.length-1;
        long ans = 0;
        while (left<right){
            if (chars[left]=='1'&&chars[right]=='0'){
                ans+=right-left;
                left++;
                right--;
            }else if (chars[left]!='1'){
                left++;
            }else if (chars[right]!='0'){
                right--;
            }
        }
        return ans;

    }
}
